home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Demos / A.D. Software / OOFILE / PhoneControl OOFILE sample / Source / CCompletedImport.cp < prev    next >
Text File  |  1995-12-13  |  3KB  |  163 lines

  1.     // CCompletedImport.cp -- dialog methods
  2.     // Created 01/01/95 12:01 PM by AppMaker
  3.  
  4.     #include "CCompletedImport.h"
  5.  
  6.  
  7.     #include <UReanimator.h>
  8.     #include <LStream.h>
  9.     #include <LStdControl.h>
  10.     #include <LCaption.h>
  11.     #include <PP_Messages.h>
  12.  
  13.     #define PPob_CompletedImportID    203
  14.     #define RidL_CompletedImportID    203
  15.  
  16.     //----------
  17.     CCompletedImport*
  18.     CCompletedImport::CreateCompletedImport(
  19.     LCommander    *inSuperCommander)
  20.     {
  21.          return ((CCompletedImport *)LWindow::CreateWindow(PPob_CompletedImportID, inSuperCommander));
  22.     }
  23.  
  24.     //----------
  25.     //    This is the function you register with URegistrar to create a
  26.     //    CCompletedImport from a resource
  27.     CCompletedImport*
  28.     CCompletedImport::CreateCompletedImportStream(
  29.     LStream    *inStream)
  30. {
  31.     return (new CCompletedImport(inStream));
  32. }
  33.  
  34. //----------
  35. //    The default constructor does nothing.
  36. CCompletedImport::CCompletedImport()
  37. {
  38. }
  39.  
  40. //----------
  41. //    The read-from-stream constructor just reads a dialog object.
  42. CCompletedImport::CCompletedImport(
  43.     LStream    *inStream)
  44.         : LDialogBox(inStream)
  45. {
  46. }
  47.  
  48. //----------
  49. //    The destructor does nothing.
  50. CCompletedImport::~CCompletedImport()
  51. {
  52. }
  53.  
  54. //----------
  55. //    This member function gets called once the containment hierarchy that contains
  56. //    this pane has been built. It gives us a chance to get data members for
  57. //    interesting subviews, and to do other operations now that our subviews exist.
  58. void
  59. CCompletedImport::FinishCreateSelf()
  60. {
  61.     LDialogBox::FinishCreateSelf();
  62.  
  63.     mOKButton = (LStdButton *)FindPaneByID('OK  ');
  64.     mNumImported = (LCaption *)FindPaneByID('NImp');  // added so we can alter later
  65.  
  66.     UReanimator::LinkListenerToControls(this, this, RidL_CompletedImportID);
  67.         // the purpose is to "connect" self to whatever controls
  68.         // that we want to "listen" to
  69.  
  70. // any additional initialization for your dialog:
  71.  
  72. }
  73.  
  74. //----------
  75. void
  76. CCompletedImport::ListenToMessage(
  77.     MessageT    inMessage,
  78.     void        *ioParam)
  79. {
  80.     switch (inMessage) {
  81.     case msg_OK:
  82.                  GetSuperCommander()->ProcessCommand(cmd_CompletedImport, this);
  83.     break;
  84.  
  85.      case msg_Cancel:
  86.              DoClose();
  87.          break;
  88.     default:
  89.         break;
  90.     }
  91. }
  92.  
  93.  
  94. //----------
  95. Boolean
  96. CCompletedImport::ObeyCommand(
  97.     CommandT    inCommand,
  98.     void        *ioParam)
  99. {
  100.     Boolean        cmdHandled = true;
  101.  
  102.     switch (inCommand) {
  103.  
  104.     // +++ Add cases here for the commands you handle
  105.     //        Remember to add same cases to FindCommandStatus below
  106.     //        to enable/disable the commands
  107.  
  108.     default:
  109.             cmdHandled = LDialogBox::ObeyCommand(inCommand, ioParam);
  110.         break;
  111.     }
  112.  
  113.     return cmdHandled;
  114. }
  115.  
  116. //----------
  117. void
  118. CCompletedImport::FindCommandStatus(
  119.     CommandT    inCommand,
  120.     Boolean        &outEnabled,
  121.     Boolean        &outUsesMark,
  122.     Char16        &outMark,
  123.     Str255        outName)
  124. {
  125.     outUsesMark = false;
  126.  
  127.     switch (inCommand) {
  128.  
  129.     // +++ Add cases here for the commands you handle
  130.  
  131.     default:
  132.             LDialogBox::FindCommandStatus(inCommand, outEnabled,
  133.                                             outUsesMark, outMark, outName);
  134.         break;
  135.     }
  136. }
  137.  
  138. //----------
  139. Boolean
  140. CCompletedImport::FocusDraw()
  141. {
  142.     Boolean        focused = LView::FocusDraw();
  143.  
  144.     if (focused) {
  145.         AuxWinHandle    awHndl;
  146.         CTabHandle        awCTable;
  147.         ColorSpec        contentSpec;
  148.  
  149.         GetAuxWin(GetMacPort(), &awHndl);
  150.         awCTable = (**awHndl).awCTable;
  151.         contentSpec = (**awCTable).ctTable [wContentColor];        // should search vs. index
  152.         ::RGBBackColor(&contentSpec.rgb);
  153.     }
  154.  
  155.     return focused;
  156. }
  157.  
  158.  
  159. void
  160. CCompletedImport::SetImported(unsigned long inCount)
  161. {
  162.     mNumImported->SetValue(inCount);
  163. }